n = int(input())
m = 0

if n > 2000 and n <= 2100:
    for i in range(2001,n+1):
        if  i%4==0 and not i%100 == 0 or i%400 ==0:
            m = 1
            print(i)
    if m == 0:
        print(None)
else:
     print("Invalid year!")

